import time


class PersonBase():
    """人物基础属性"""
    def __init__(self):
        self.hp = 100
        self.sp = 200
        self.speed = 0
        self.hp_add = 10
        self.sp_add = 5
        self.speed_add = 30
        self.attack = 20
        self.name = None
        self.duiA = 10

    def AAAAA(self):
        self.duiA += 1
        self.hp -= 2

    def attacking(self):
        if self.sp >= 10:
            self.sp -= 10
        else:
            print("技能攻击失败")
            self.AAAAA()

    def add_a(self):
        if self.sp >= 10:
            self.sp -= 10
            self.hp += self.hp_add
            print(self.name, "回复了", self.hp_add, "点血量")
        else:
            print("小治疗术失败")
            self.AAAAA()

    def add_b(self):
        if self.sp >= 20:
            self.sp -= 20
            self.hp += self.hp_add * 2
            print(self.name, "回复了", 2 * self.hp_add, "点血量")
        else:
            print("大治疗术失败")
            self.add_a()

    def death(self):
        print(self.name + "死亡")

    def go(self):
        self.speed += self.speed_add


class LiXiaoYao(PersonBase):
    """李逍遥类"""
    def __init__(self):
        super().__init__()
        self.name = "李逍遥"
        self.attack = 50
        self.speed_add = 35
        self.master_stroke = 0

    def js(self):
        if self.sp > 0:
            self.sp = 0
            self.master_stroke = 70
            self.master_stroke += self.duiA
            print("李逍遥使用了剑神")

        else:
            print("剑神失败")
            self.attacking()


class BaiYue(PersonBase):
    """拜月教主类"""
    def __init__(self):
        super().__init__()
        self.name = "拜月教主"
        self.hp = 300
        self.hp_add = 25
        self.sp = 300


def main():
    lxy = LiXiaoYao()
    by = BaiYue()
    print(lxy.name)
    d = 0
    while lxy.hp > 0 and by.hp > 0:
        d += 1
        lxy.go()
        by.go()
        if lxy.speed >= 100:
            print("李逍遥   hp:", lxy.hp, "sp:", lxy.sp)
            print("拜月教主 hp:", by.hp, "sp:", by.sp)
            lxy.speed = 0
            if lxy.sp < 10:
                lxy.AAAAA()
                by.hp -= lxy.duiA
                print("李逍遥对拜月教主造成了", lxy.duiA, "点伤害")
            elif d == 24:
                lxy.js()
                by.hp -= lxy.master_stroke
                print("李逍遥对拜月教主造成了", lxy.master_stroke, "点伤害")
            elif d % 6 == 1 or d % 6 == 2 or d % 6 == 3 or d % 6 == 5:
                by.hp -= lxy.attack
                print("李逍遥对拜月教主造成了", lxy.attack, "点伤害")
            elif d % 6 == 0:
                lxy.add_a()
            elif d % 6 == 4:
                lxy.add_b()
        time.sleep(10)
        if by.speed >= 100:
            by.speed = 0
            if by.sp >= 10:
                if d % 5 == 0 or d % 5 == 1 or d % 5 == 2:
                    by.attacking()
                    lxy.hp -= by.attack
                    print("李逍遥受到了", by.attack, "点伤害")
                elif d % 5 == 3:
                    by.add_a()
                elif d % 5 == 4:
                    by.add_b()
            else:
                by.AAAAA()
                lxy.hp -= by.duiA
                print("李逍遥受到了", by.duiA, "点伤害")
    if lxy.hp <= 0:
        lxy.death()
    if by.hp <= 0:
        by.death()


if __name__ == '__main__':
    main()

